package com.zyylr.classroomreservationsystem.activity;

import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.wakehao.bar.BottomNavigationBar;
import com.wakehao.bar.BottomNavigationItemWithDot;
import com.zyylr.classroomreservationsystem.R;


/**
 * 预约申请审核管理员活动
 */
public class AuditAdminActivity extends MyBaseCompatActivity {
    private BottomNavigationBar bar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_audit_admin);

        //使界面顶部沉浸式
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            //给状态栏设置颜色。我设置透明。
            window.setStatusBarColor(Color.TRANSPARENT);
            window.setNavigationBarColor(Color.TRANSPARENT);
        }


        bar = (BottomNavigationBar) findViewById(R.id.bar_audit_admin);
        //bar.setTitle(1,"home");

        //position > 0 可以拖拽
        //position < 0 不能拖拽
        //bar.showNum(0, 80);      //auditing
        //bar.showNum(1, 100);     //已审核
        //bar.showNum(2, -1);      //。。。
        // bar.disMissNum(2);


        //点击事件
        bar.setOnNavigationItemSelectedListener(new BottomNavigationBar.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull BottomNavigationItemWithDot item, int selectedPosition) {
                if (selectedPosition == 1) {
//                    startActivityForResult(new Intent(MainActivity.this,LoginActivity.class),1);
                    //用户切换item
                    bar.setItemSelected(1, true);
                    //返回false表示不响应点击事件
                    return false;
                } else return true;
            }

            @Override
            public void onNavigationItemSelectedAgain(@NonNull BottomNavigationItemWithDot item, int reSelectedPosition) {
                //   Toast.makeText(CommonUserActivity.this,"you click it again on item :"+reSelectedPosition,Toast.LENGTH_SHORT).show();

            }
        });
    }

    public void login(View view) {
        setResult(RESULT_OK);
        finish();
    }


}
